package com.ssy.lingxi.common.constant.member;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 会员状态枚举
 * @author 万宁
 * @version 2.0.0
 * @date 2020-06-24
 */
public enum MemberStatusEnum {

    /**
     * 正常 - 1
     */
    NORMAL(1, "正常"),

    /**
     * 冻结 - 2
     */
    FROZEN(2, "冻结"),

    /**
     * 整改 - 3
     */
    CORRECTING(3, "整改"),

    /**
     * 淘汰 - 4
     */
    ELIMINATED(4, "淘汰"),

    /**
     * 黑名单 - 5
     */
    BLACK_LIST(5, "黑名单");

    private Integer code;

    MemberStatusEnum(Integer code, String msg) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return LanguageHolder.getName(this.getClass(), this.getCode());
    }

    public static String getCodeMessage(Integer code) {
        return LanguageHolder.getName(MemberStatusEnum.class, code);
    }

    public static List<Integer> toList() {
        return Arrays.stream(MemberStatusEnum.values()).map(MemberStatusEnum::getCode).collect(Collectors.toList());
    }
}
